import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import NProgress from 'nprogress'
import ElementUI from 'element-ui'
import ViewUI from 'view-design'
import 'view-design/dist/styles/iview.css'
import '../node_modules/element-ui/lib/theme-chalk/index.css'
import './assets/global.css'

Vue.use(ElementUI);
Vue.use(ViewUI)

Vue.config.productionTip = false

//配置请求的根路径
axios.defaults.baseURL = 'http://121.36.18.70:5000/api/';
// axios.defaults.baseURL = 'http://121.36.18.70:8888/api/'

Vue.prototype.$http = axios;

// 在 request 拦截器中，展示进度条 NProgress.start()
axios.interceptors.request.use(config => {
        // 发送报文头添加 token
        config.headers.Authorization = window.sessionStorage.getItem('token');
        NProgress.start()
            // 函数结尾处必须返回config
        return config;
    })
    // 在 respon 拦截器中，隐藏进度条 NProgress.done()
axios.interceptors.response.use(config => {
    NProgress.done()
    return config;
})


new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')